import request from '@/utils/request'

// 获取第三方订单分页列表
export function pageThirdOrder(query) {
  return request({
    url: '/order/third/paging',
    method: 'get',
    params: query
  })
}

// 统计第三方订单
export function statThirdOrder(query) {
  return request({
    url: '/order/third/statThirdOrder',
    method: 'get',
    params: query
  })
}

// 统计可合并第三方订单列表
export function statMergeOrder(query) {
  return request({
    url: '/order/third/statMergeOrder',
    method: 'get',
    params: query
  })
}

// 获取上一笔订单id
export function getPrevId(thirdOrderId) {
  return request({
    url: '/order/third/getPrevId',
    method: 'get',
    params: { thirdOrderId }
  })
}

// 获取下一笔订单id
export function getNextId(thirdOrderId) {
  return request({
    url: '/order/third/getNextId',
    method: 'get',
    params: { thirdOrderId }
  })
}

// 获取第三方订单
export function getThirdOrder(thirdOrderId) {
  return request({
    url: '/order/third/get',
    method: 'get',
    params: { thirdOrderId }
  })
}

// 获取第三方订单
export function getByNoAndType(externalOrderNo, platformType) {
  return request({
    url: '/order/third/getByNoAndType',
    method: 'get',
    params: { externalOrderNo, platformType }
  })
}

// 获取第三方订单列表
export function listThirdDetail(query) {
  return request({
    url: '/order/third/listThirdDetail',
    method: 'get',
    params: query
  })
}

// 合并订单
export function doMergeOrder(data) {
  return request({
    url: '/order/third/doMergeOrder',
    method: 'post',
    data: data
  })
}

// 生成第三方订单
export function doGenerateOrder(data) {
  return request({
    url: '/order/third/doGenerateOrder',
    method: 'post',
    data: data
  })
}

// 删除第三方订单
export function deleteThirdOrder(data) {
  return request({
    url: '/order/third/delete',
    method: 'post',
    data: data
  })
}

// 审核顾客修改收货信息申请
export function doAuditAddress(thirdOrderId, isApproved) {
  return request({
    url: '/order/third/doAuditAddress',
    method: 'post',
    data: { thirdOrderId, isApproved }
  })
}

// 保存第三方订单情况
export function saveThirdOrder(data) {
  return request({
    url: '/order/third/save',
    method: 'post',
    data
  })
}

// 解密收货信息
export function decryptReceiveInfo(externalOrderNo, platformType, decryptReportType) {
  return request({
    url: '/order/third/decryptReceiveInfo',
    method: 'get',
    params: { externalOrderNo, platformType, decryptReportType }
  })
}

// 更新地址信息
export function updateReceiveInfo(data) {
  return request({
    url: '/order/third/updateReceiveInfo',
    method: 'post',
    data: data
  })
}

// 校验第三方订单状态
export function checkThirdOrder(query) {
  return request({
    url: '/order/third/checkThirdOrder',
    method: 'get',
    params: query
  })
}
